home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / win-os2.swg / 0043_Word Wrapping In Windows.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-08-25  |  1.2 KB  |  49 lines

  1. {
  2. From: wieger@wsintt02.info.win.tue.nl (Wieger Wesselink)
  3.  
  4. I have written the following program that contains a wordwrap editor that
  5. inherits from TFileWindow. The wordwrapping is achieved by modifying the
  6. Style field of the Editor-object in TFileWindow. This works fine except
  7. for one thing: saving the contents of the editor goes wrong. Sometimes the
  8. last line is truncated. Can anyone tell me how to fix this problem?
  9. Thanks in advance,
  10.  
  11. }
  12. program WordWrap;
  13.  
  14. uses WinTypes, OWindows, OStdWnds;
  15.  
  16. type
  17.   PMyFileWindow = ^TMyFileWindow;
  18.   TMyFileWindow = object(TFileWindow)
  19.     constructor Init(AParent: PWindowsObject; ATitle, AFileName: PChar);
  20.   end;
  21.  
  22.   TMyApplication = object(TApplication)
  23.     procedure InitMainWindow; virtual;
  24.   end;
  25.  
  26. constructor TMyFileWindow.Init(AParent: PWindowsObject; ATitle,
  27.         AFileName: PChar);
  28. begin
  29.   inherited Init(AParent, ATitle, AFileName);
  30.   with Editor^.Attr do begin
  31.     Style := Style and not (es_AutoHScroll or ws_HScroll);
  32.   end;
  33. end;
  34.  
  35. procedure TMyApplication.InitMainWindow;
  36. begin
  37.   MainWindow := New(PMyFileWindow, Init(nil, 'WordWrapper', nil));
  38. end;
  39.  
  40. var
  41.   MyApp: TMyApplication;
  42.  
  43. begin
  44.   MyApp.Init('WordWrap');
  45.   MyApp.Run;
  46.   MyApp.Done;
  47. end.
  48.  
  49.